﻿@model Gfw.Web.Models.SystemUser.NewUserModel
@{
    ViewBag.Title = "编辑帐户";
    Layout = "~/Views/Shared/_Content.cshtml";
}
@using (Ajax.BeginForm("Edit", "SystemUser", null, Gfw.Web.Common.ViewHelper.AjaxPost))
{
    if (ViewBag.Done)
    {
    <h4>人员信息已经保存.</h4>
    <div class="button">
        @Ajax.ActionLink("返回人员列表", "Index", new { page = 1 }, Gfw.Web.Common.ViewHelper.AjaxGet)
    </div>
    }
    else
    {
    @Html.HiddenFor(model => model.Id)
    @Html.HiddenFor(model => model.Departmentid)  
    <ul>
        <li>@Html.LabelFor(model => model.LoginName)</li>
        <li>@Html.EditorFor(model => model.LoginName)
            @Html.ValidationMessageFor(model => model.LoginName)</li>
        <li>
            @Html.LabelFor(model => model.Password)
        </li>
        <li>
            @Html.PasswordFor(model => model.Password)
            @Html.ValidationMessageFor(model => model.Password)
        </li>

        <li>
            @Html.LabelFor(model => model.SecondPassword)
        </li>
        <li>
            @Html.PasswordFor(model => model.SecondPassword)
            @Html.ValidationMessageFor(model => model.SecondPassword)
        </li>
        <li>
            @Html.LabelFor(model => model.Name)
        </li>
        <li>
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </li>

        <li>
            @Html.LabelFor(model => model.Tel)
        </li>
        <li>
            @Html.EditorFor(model => model.Tel)
            @Html.ValidationMessageFor(model => model.Tel)
        </li>

        <li>
            @Html.LabelFor(model => model.Address)
        </li>
        <li>
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </li>

        <li>
            @Html.LabelFor(model => model.Qq)
        </li>
        <li>
            @Html.EditorFor(model => model.Qq)
            @Html.ValidationMessageFor(model => model.Qq)
        </li>

        <li>
            @Html.LabelFor(model => model.Email)
        </li>
        <li>
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </li>

        <li>
            @Html.LabelFor(model => model.IdCard)
        </li>
        <li>
            @Html.EditorFor(model => model.IdCard)
            @Html.ValidationMessageFor(model => model.IdCard)
        </li>
        <li>
            @Html.LabelFor(model => model.IsLock)
        </li>
        <li>
            @{
        var list = new List<SelectListItem>();
       
        list.Add(new SelectListItem() { Selected = true, Value = "1", Text = "锁定" });
        list.Add(new SelectListItem() { Selected = true, Value = "0", Text = "正常" });
  
            }
            @Html.DropDownListFor(model => model.IsLock, list)
            @Html.ValidationMessageFor(model => model.IsLock)
        </li>
        <li>
            @Html.LabelFor(model => model.UserRoles)
        </li>
        <li>
            @for (int i = 0; i < Model.UserRoles.Count; i++)
            {
                @Html.HiddenFor(model => model.UserRoles[i].Id)
                @Html.CheckBoxFor(model => model.UserRoles[i].IsCheck)
                @Html.DisplayTextFor(model => model.UserRoles[i].Name)
          
            }
        </li>
    </ul>
    @Html.ValidationSummary(true)

    <div class="button">
        @Ajax.ActionLink("返回", "Index", new { page = 1 }, Gfw.Web.Common.ViewHelper.AjaxGet)
        <input type="submit" value="提交" />
    </div>
    }
}
